<%-- 
    Document   : Registry
    Created on : Nov 2, 2011, 12:03:50 AM
    Author     : MrKoi
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>East2West Tours and Travels</title>
        <script src="js/gen_validatorv4.js" type="text/javascript"></script>
        <style type="text/css">
            .khun
            {
                    background-color:#f0f3ec;
                    width:640px;
                    height:760px;
                    margin-left:auto;
                    margin-right:auto;
                    margin-top:6px;
            }
            .table
            {
                font-family:"Times New Roman", Times, serif;
                color:black;
                font-size:0.9em;
            }
             .font
            {
            font-family:"Times New Roman", Times, serif;
            font-size:x-large;
            font-weight:bold;
            width:200px;
            margin-left:auto;
            margin-right:auto;
            color:#0707e7;
            }
        </style>
         <script type="text/javascript">
            function ajax(str) {
            var xmlhttp;
            if(str.length==0)
            {
            document.getElementById("alert").innerHTML="";
            return;
            }
             try {
              xmlhttp=new XMLHttpRequest();
             }
             catch (e) {
              try {
               xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
              }
                catch (e) {
               try {
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
               }
               catch (e) {
                alert("Your browser does not support AJAX!");
                return false;
               }
              }
             }             
             xmlhttp.onreadystatechange=function() {
              if(xmlhttp.readyState==4 && xmlhttp.status==200) {  
                    
                    document.getElementById("alert").innerHTML=xmlhttp.responseText;
                 }
             }
             var url='ControllerCustomer?user='+str+'&&Rg=Registry';
             xmlhttp.open("GET",url,true);
             xmlhttp.send();
            } 
        </script>
    </head>
    <body>
       
        <div class="khun">
            <center>
            <form action="ControllerCustomer" method="post" id="commentForm" > 
            <table class="table" border="0" cellpadding="5" cellspacing="5" width="600px" >
                     <tr>
                        <td colspan="2" align="center" class="font"> Registry Customer</td>
                        <td></td>
                     </tr>    
                     <tr>
                         <td colspan="3" height="20px"></td>
                     </tr>
                    <tr>
                        
                        <td width="90px">User Name:</td>
                        <td width="150px" ><input type="text" name="username"   maxlength="20" size="30"  onkeyup="ajax(this.value);"/><div style="color:red;" id="alert"></div></td>
                        <td style="color:red;"><div id='commentForm_username_errorloc' class="error_strings"></div></td>
                    </tr>    
                    <tr>
                        <td>Password:</td>
                        <td ><input type="password" id="password" name="password" maxlength="15" size="30" /></td>
                        <td style="color:red;"><div id='commentForm_password_errorloc' class="error_strings"></div></td>
                    </tr>
                    <tr>
                        <td>Comfirm Pass:</td>
                        <td ><input type="password" id="confirm_password" name="confirm_password" maxlength="50" size="30" /></td>
                        <td style="color:red;"><div id='commentForm_confirm_password_errorloc' class="error_strings"></div></td>
                    </tr>
                    <tr>
                        <td>Full Name:</td>
                        <td style="color:red;"><input type="text" id="fullname" name="fullname" maxlength="40" size="30" /></td>
                        <td style="color:red;"><div id='commentForm_fullname_errorloc' class="error_strings"></div></td>
                    </tr>
                    <tr>
                        <td>Gender:</td>
                        <td>
                            <input type="radio" name="gender" value="Male" checked="True" />Male
                            <input type="radio" name="gender" value="Female" />Female
                        </td>
                    </tr>
                    <tr>
                        <td>Email:</td>
                        <td style="color:red;"><input type="text" name="email" size="30" /></td>
                        <td style="color:red;"><div id='commentForm_email_errorloc' class="error_strings"></div></td>
                    </tr>
                    <tr>
                        <td>Country:</td>
                        <td>
                            <select name="country" id="country">
                             <option value="0">---Choose---</option>
                             <option value="Viet Nam">Viet Nam</option>
                             <option value="Lao">Lao</option>
                             <option value="CamPuchia">CamPuchia</option>
                             <option value="Thai Lan">Thai Lan</option>
                             <option value="Indonesia">Indonesia</option>
                             <option value="Singapore">singapore</option>
                             <option value="Japan">Japan</option>
                             <option value="Russia">Russia</option>
                             <option value="Korea">Korea</option>
                             <option value="England">England</option>
                             <option value="France">France</option>
                             <option value="Australia">Australia</option>
                             <option value="United States">United States</option> 
                            </select>
                        </td>
                       <td style="color:red;"><div id='commentForm_country_errorloc' class="error_strings"></div></td>
                    </tr>
                    <tr>
                        <td>Address:</td>
                        <td style="color:red;"><textarea rows="6" cols="25" name="address"  size="30" ></textarea></td>
                        <td style="color:red;"><div id='commentForm_address_errorloc' class="error_strings"></div></td>
                    </tr>
                    <tr>
                        <td>Phone:</td>
                        <td style="color:red;"><input type="text" name="phone" maxlength="13" size="30" /></td>
                        <td style="color:red;"><div id='commentForm_phone_errorloc' class="error_strings"></div></td>
                    </tr>
                    <tr>
                        <td colspan="2" align="center" ><input class="submit" type="submit" name="registry" value="Registry"/><input type="reset" value="Reset" /></td>
                    </tr>
                    </table>
                </form>
                </center>
             </div>
         <script language="JavaScript" type="text/javascript">
            var frmvalidator  = new Validator("commentForm");
            frmvalidator.EnableOnPageErrorDisplay();
            frmvalidator.EnableMsgsTogether();
            
            frmvalidator.addValidation("username","req","*");
            frmvalidator.addValidation("username","minlength=5", "Username at least 5 characters");
            frmvalidator.addValidation("username","regexp=^[A-Za-z_0-9]{1,20}$","Username should be a valid alphabetic value");
             
            frmvalidator.addValidation("password","req","*");
            frmvalidator.addValidation("password","minlength=8", "Password at least 8 characters");
            
            frmvalidator.addValidation("confirm_password","req","*");
            frmvalidator.addValidation("confirm_password","eqelmnt=password", "Please enter the same password as above");
            
            frmvalidator.addValidation("fullname","req","*");
            frmvalidator.addValidation("fullname","minlength=4", "Full name at least 4 characters");
            
            frmvalidator.addValidation("email","req","*");
            frmvalidator.addValidation("email","email","Please enter a valid email address");
            
            frmvalidator.addValidation("country","dontselect=0","Choose a country ");
            
            frmvalidator.addValidation("address","req","*");
            frmvalidator.addValidation("address","minlength=15", "Address at least 15 characters");
            
            frmvalidator.addValidation("phone","req","*");
            frmvalidator.addValidation("phone","minlength=10","Phone number at least 10 digits");
            frmvalidator.addValidation("phone","numeric","Please enter only digits");
            
        </script>
    </body>
</html>
